#ifndef BigIntPtr_H

	#define BigIntPtr_H
	#include <iostream>
	#include <string>
	#include <vector>
	#include <algorithm>
	#include "bigint.h"	
		class PtrCounter
		{
		private:
			BigInt * ptr;
			int qty;
			explicit PtrCounter(BigInt * num);
			void Dec();
			void Inc();
			bool isZero();
		public:
			~PtrCounter();
			friend class BigIntPtr;
		};

		class BigIntPtr
		{		
		private:
			PtrCounter * counter;
			
		public:
			explicit BigIntPtr(BigInt * num);
			explicit BigIntPtr(BigIntPtr const & p);
			~BigIntPtr();
			
			void Swap(BigIntPtr & p);
			BigInt * get() const;
			int UseCount() const;
			
			BigIntPtr & operator =(BigIntPtr const & p);
			BigInt * operator ->() const;
			BigInt & operator *() const;
		};
		
		bool operator ==(BigIntPtr const & p, BigIntPtr const & q);
		bool operator != (BigIntPtr const & p, BigIntPtr const & q);
		bool operator <  (BigIntPtr const & p, BigIntPtr const & q);
		bool operator >  (BigIntPtr const & p, BigIntPtr const & q);
#endif